<%@ page language="java" import="java.util.*,java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'showanddelete.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
	<%
	Class.forName("com.mysql.jdbc.Driver");
	Connection con = DriverManager.getConnection("jdbc:mysql://localhost/jobs?useUnicode=true&characterEncoding=UTF8","root","");
	Statement st = con.createStatement();
	ResultSet rs = st.executeQuery("select * from ad order by id desc");
	%>
	<table width="100%" border="1" style="text-align:center;font-size:12px;">
			<tr>
				<td>编号</td>
				<td>企业名称</td>
			</tr>
		<%
	while(rs.next()){
	 %>
			<tr>
				<td style="text-align:center;font-size:12px;"><%=rs.getInt("id") %></td>
				<td><img src="<%=rs.getString("lujing") %>"/></td>
			</tr>
	<%} %>	
</table>
<div id="dd" style="display:none; position:absolute; border:1px #000000 solid;"><img id="nn" src=""/></div>
  </body>
</html>
<script src="./includes/ajax.js"></script>
<script>
function chakan(id,oEvent){
	var d = document.getElementById("dd");
	var  n = document.getElementById("nn");
	var ajax=initAjax();
	ajax.open("get","<%=basePath%>servlet/ShowImageServlet?id="+id+"&r="+Math.random(),true);
	ajax.send(null);
	ajax.onreadystatechange = function (){
				if(ajax.readyState == 4){alert(id);alert(ajax.responseText);
				n.src = ajax.responseText;
				//var x=parseInt(oEvent.clientX);
   				//var y=parseInt(oEvent.clientY);
				//d.style.left = x+10+"px";
				//d.style.top = y+10+"px";
				d.style.display = "block";
		}
	}
}
</script>